<template>
  <div class="router-name">
    <a-button ghost class="back" v-if="isBack" @click="$router.back()"
      >返回</a-button
    >
    <span v-if="showTitle() === '[object Array]'" >
      {{ title[0] }}
      <span style="font-size: 14px; color: #888888;"> - {{ title[1] }} </span>
    </span>
    <span v-else-if="showTitle() === 'String'">
      {{ title? title : $route.meta.title }}
      <span></span>
    </span>
    <span v-else>{{ $route.meta.title }}</span>
  </div>
</template>

<script>
export default {
  props: {
    isBack: {
      type: Boolean,
      default: false,
    },
    title:{
      default: null
    }
  },

  data () {
    return {
      
    }
  },

  methods: {
    showTitle () {
      let type = Object.prototype.toString.call(this.title)
      return type
    },
  },

};


</script>

<style lang="less" scoped>
.router-name {
  font-size: 16px;
  font-weight: 600;
  color: #101011;
  display: flex;
  align-items: center;
  .back {
    color: #000;
    border: 1px solid #e0e0e6;
    margin-right: 10px;
    border-radius: 5px;
  }
}
</style>
